package com.yidu.ladder.system.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yidu.ladder.system.domain.ArtificialDispatchVo;
import com.yidu.ladder.system.service.ArtificialDispatchService;

@Controller
@RequestMapping("/sys/dispatch/")
public class ArtificialDispatchController {

	@Autowired
	private ArtificialDispatchService artificialDispatchService;

	public ArtificialDispatchService getArtificialDispatchService() {
		return artificialDispatchService;
	}

	public void setArtificialDispatchService(ArtificialDispatchService artificialDispatchService) {
		this.artificialDispatchService = artificialDispatchService;
	}
	
	/**
	 *  添加人工调度信息
	 * @param artificialDispatchVo 人工调度包装类
	 * @return 添加成功返回1，否则返回0
	 */
	@RequestMapping(value = "add", method = RequestMethod.POST)
	@ResponseBody
	public int insert(ArtificialDispatchVo artificialDispatchVo) {
		System.out.println("add");
		return artificialDispatchService.insert(artificialDispatchVo);
	}
	
	/**
	 *  修改人工调度信息
	 * @param artificialDispatchVo 人工调度包装类
	 * @return 修改成功返回1，否则返回0
	 */
	@RequestMapping(value = "update", method = RequestMethod.POST)
	@ResponseBody
	public int update(ArtificialDispatchVo artificialDispatchVo) {
		System.out.println("update");
		return artificialDispatchService.update(artificialDispatchVo);
	}
	
	/**
	 *  根据id删除人工调度信息
	 * @param dispatchId 人工调度id
	 * @return 删除成功返回1，否则返回0
	 */
	@RequestMapping(value = "delete/{orgIds}", method = RequestMethod.DELETE)
	@ResponseBody
	public int delete(@PathVariable("orgIds") String dispatchIds) {
		System.out.println("delete");
		return artificialDispatchService.delete(dispatchIds);
	}
	
	/**
	 * 条件查询人工调度信息集合
	 * @param artificialDispatchVo 人工调度包装类
	 * @return 人工调度对象集合
	 */
	@RequestMapping(value = "selectList", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> select(ArtificialDispatchVo artificialDispatchVo) {
		System.out.println("selectList");
		return artificialDispatchService.select(artificialDispatchVo);
	}
	
	/**
	 * 人工调度页面方法
	 * @return 人工调度页面
	 */
	@RequestMapping("dispatchList")
	public String dispatchList() {System.out.println("dispatchList");
		return "dispatchList";
	}

}
